275. H 指数 II
为保证权益,题目请参考 275. H 指数 II(From LeetCode).
解决方案1
Python
python
# 275. H 指数 II
# https://leetcode-cn.com/problems/h-index-ii/
from typing import List
class Solution:
def hIndex(self, citations: List[int]) -> int:
i = -1
n = 1
for i in range(len(citations) - 1, -1, -1):
if citations[i] >= n:
n += 1
else:
break
return n - 1
if __name__ == "__main__":
so = Solution()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20